export const getItem = (key) => {
    let data = window.sessionStorage.getItem(key)
    if (data) {
        return JSON.parse(data)
    } else {
        return false
    }
};
export const setItem = (key, data) => {
    if (data) {
        window.sessionStorage.setItem(key, JSON.stringify(data))
        return true
    } else {
        return true
    }
};
export const removeItem = (key) => {
    window.sessionStorage.removeItem(key)
    return true
};

export const updateItem = (key, obj) => {
    let data = window.sessionStorage.getItem(key)
    if (data) {
        data = JSON.parse(data);
        window.sessionStorage.setItem(key, JSON.stringify({ ...data, ...obj }))
        return true
    } else {
        return false
    }
};
export const clear = () => {
    window.sessionStorage.clear()
    return true
};